//
//  ViewController.h
//  MathMastersAsteroids
//
//  Created by Jordon Phillips on 3/12/10.
//  Copyright 2010 __MyCompanyName__. All rights reserved.
//
//  The view controller for asteroid math
//
//   BUG: In the simulator it will not detect touch events under where the status bar used to be
//        This makes the pause button not very responsive, this should not be there on the acutal device

#import <UIKit/UIKit.h>
#import "EAGLView.h"


@interface ViewController : UIViewController {
	EAGLView *glView;//the game view
	UIView *lastView;//used to hold the menu view
	UIView *options;//the options menu
	UIView *tutorial;//the tutorial menu
	UIView *ranking;//the ranking menu
	NSTimer *gameCheck;//checks values in the game at certain intervals
	UILabel *label;//label used to display the score
	UIButton *resumeButton;//the button to resume the game
	UISegmentedControl *difficultySwitch;//the difficulty switch
	UISegmentedControl *rankingSwitch;//the ranking difficulty switch
	UILabel *difficultyDesc;//the difficulty description
	UILabel *rankings;//the rankings table
	UIImageView *tutorialImage;//the tutorial image
	UILabel *tutorialDesc;//the tutorial description
	UIImage *move1;//the first move tutorial image
	UIImage *move2;//the second move tutorial image
	UIImage *shoot1;//the first shoot tutorial image
	UIImage *shoot2;//the second shoot tutorial image
	UIImage *equation1;//the first equation tutorial image
	UIImage *equation2;//the second equation tutorial image
	UIImage *wrong1;//the first wrong tutorial image
	UIImage *wrong2;//the second wrong tutorial image
	UIImage *pause;//the pause tutorial image
	UIButton *tutNext;//the next page button for the tutorial
	UIButton *tutPrev;//the prev page button for the tutorial
	BOOL resume;//determines whether the game is resumable
	BOOL sound;//determines if the sound is on or off
	BOOL music;//determines if the music is on or off
	int difficulty;//determines the difficulty for a new game 0=easy 1=medium 2=hard
	int tutPage;//the current page for the tutorial(0-4)
	BOOL tutImage;//deterimes if the tutorial image is on image 1 or image 2
	int rankingDifficulty;//the difficulty setting for the ranking screen 0=easy 1=medium 2=hard
	NSTimer *changeTutImage;//alternates the tutorial images
	int easyRanking[10];//the score table for easy mode
	int mediumRanking[10];//the score table for medium mode
	int hardRanking[10];//the score table for hard mode
	NSString *docsDirectory;
	NSString *path;	
	NSString *fileContents;
	NSArray *lines;
	NSString *save;
	NSData *dataToWrite;
	
}
@property (nonatomic, retain) IBOutlet EAGLView *glView;
@property UIView *lastView;
@property (nonatomic, retain) IBOutlet UIView *options;
@property (nonatomic, retain) IBOutlet UIView *tutorial;
@property (nonatomic, retain) IBOutlet UIView *ranking;
@property IBOutlet UILabel *label;
@property IBOutlet UIButton *resumeButton;
@property IBOutlet UIButton *tutNext;
@property IBOutlet UIButton *tutPrev;
@property IBOutlet UISegmentedControl *difficultySwitch;
@property IBOutlet UILabel *difficultyDesc;
@property IBOutlet UIImageView *tutorialImage;
@property IBOutlet UILabel *tutorialDesc;
@property IBOutlet UISegmentedControl *rankingSwitch;
@property IBOutlet UILabel *rankings;
- (IBAction)drawEAGLView:(id)sender;
- (IBAction)openOptions:(id)sender;
- (IBAction)closeOptions:(id)sender;
- (IBAction)resumeGame:(id)sender;
- (IBAction)soundToggle:(id)sender;
- (IBAction)musicToggle:(id)sender;
- (IBAction)changeDifficulty:(id)sender;
- (IBAction)tutorialNext:(id)sender;
- (IBAction)tutorialPrev:(id)sender;
- (IBAction)openTutorial:(id)sender;
- (IBAction)closeTutorial:(id)sender;
- (IBAction)openRanking:(id)sender;
- (IBAction)closeRanking:(id)sender;
- (IBAction)changeRanking:(id)sender;

- (void)checkGame;
- (void)updateImage;
- (void)loadRankings;
- (void)addRanking:(int)newScore:(int)rankDifficulty;

@end
